import java.sql.Array;
import java.util.Arrays;

public class Test {
    public static int[] fuc(){
        int a =1;
        int b =2;
        int[] ret = new int[]{a,b};
        return ret;
    }
    public static void main(String[] args) {
        int[] array = fuc() ;
        String s = Arrays.toString(array);
        System.out.println(s);
    }
    public static void fuc(String[] array){
        String tmp = array[0];
        array[0]=array[1];
        array[1]=tmp;

    }
    public static void main7(String[] args) {
        String[] array = new String[]{"你","好"};
        System.out.println(Arrays.toString(array));
        fuc(array);
        System.out.println(Arrays.toString(array));
    }
    public static void main6(String[] args) {
        int[] array = new int[]{1,2,3,4,5};
        for (int i = 0; i <array.length ; i++) {
            System.out.println(array[i]);
        }
    }
    public static void main5(String[] args) {

        int[] arr = null;
        System.out.println(arr[0]);

    }
    public static void fuc1(){
        int[] array1 =new int[3];
        array1[0]=10;
        array1[1]=20;
        array1[2]=30;

        int[] array2 =new int[]{1,2,3};
        array2[0]=100;
        array2[1]=200;

        array1=array2;
        array1[2]=300;

        for (int i = 0; i < array2.length; i++) {
            System.out.print(array2[i]+" ");
        }
    }

    public static void main4(String[] args) {
        fuc();
    }

    public static void main3(String[] args) {
        int a = 10;
        int b = 20;
        int[] array = new int[]{1,2,3};
    }

    public static void main1(String[] args) {
        int[] array = new int[]{1,2,3,4,5};
        //借助工具遍历
        String ret = Arrays.toString(array);
        System.out.println(ret);

        System.out.println(Arrays.toString(array));

    }
    public static void main2(String[] args) {
        int[] array = new int[]{1,2,3,4,5};
        //循环遍历
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i]+" ");
        }

        System.out.println();
        System.out.println("=========");

        //for - each遍历
        for(int x:array){
            System.out.print(x+" ");
        }

        System.out.println();
        System.out.println("=========");

        //借助工具遍历
        //String ret = Arrays.toString(array);
        //System.out.println(ret);

    }
}
